<?php
	
	$plugins['cid'] = array('icon' => 'images/misc-16x16.png', 'text' => 'CID Spoof');

	if(isset($_POST['do']) && $_POST['do']  == 'spoof'){
			
		$msg = new xmlrpcmsg('freeswitch.api',
			array(
				new xmlrpcval("jsrun", "string"),
				new xmlrpcval(sprintf("cidspoof2.js %s %s %s",  $_POST['phone'],  $_POST['cid'],  $_POST['to']), "string"),
			)
		);

		$smarty->assign('phone', $_POST['phone']);
		$smarty->assign('cid', $_POST['cid']);
		$smarty->assign('to', $_POST['to']);
		
		//$c->setDebug(2);
		$response = $client->send($msg);
		if (!$response || $response->faultCode()) {
			$error = "<BR>Fault: Code: ".$response->faultCode();
			$error.= "<BR>Reason '".$response->faultString()."'<BR>";
		}
		else
		{
			$error = php_xmlrpc_decode($response->value());
		}
		$smarty->assign('error', $error);
	}    	

	switch ($action) {
		case "cid":
			$is_plugin = 1;
			$page = '../plugins/cid/cid.tpl';
		break;
	}
?>
